<?php
	define('BDD_DSN', 'mysql:dbname=cdg;host=localhost'); // DSN BDD
	define('BDD_UTILISATEUR', 'root'); // LOGIN BDD
	define('BDD_MOT_DE_PASSE', ''); // MOT DE PASSE BDD
	define('BDD_HOST', 'localhost'); // SERVEUR BDD
	define('BDD_BASE', 'cdg'); // BASE BDD
	define('DIR_LIB', 'lib/');
	define('DIR_UPLOAD', 'xls/');
	define('DIR_LOGS', 'logs/');
	define('DIR_CACHE', 'cache/');
	define('DIR_TMP', 'tmp/');
	define('DIR_TRAD', 'trad/');
	define('DIR_IMG', 'img/');
	
	include_once('../../lib/class.fonctions.php');
	include_once('../../lib/class.cache.php');
	include_once('../../lib/class.db.php');
	include_once('../../lib/class.debug.php');
	include_once('../../lib/class.activerecord.php');
	include_once('../../lib/class.secure.php');
	include_once('../../lib/class.wrapper.php');
	include_once('../../lib/class.sqlobjet.php');
	include_once('../../lib/_fo_products.php');
	include_once('../../lib/_fo_samples_countries.php');
	include_once('../../lib/_fo_samples_by_country.php');
	include_once('../../lib/_fo_samples.php');
	
	// On instancie les classes principales
	$gp_fonc = GP_fonctions::getInstance();
	$gp_db = GP_db::getInstance(BDD_DSN, BDD_UTILISATEUR, BDD_MOT_DE_PASSE);
	$gp_request = GP_secure::getInstance();
	
	
	// Mise en place de l'ActiveRecord
	GP_ActiveRecord::setDefaultDBConnection($gp_db);
	
	// on accroit les perf si possible
	$version = explode('.', PHP_VERSION, 2);
	if($version[0] * 10 + $version[1] < 53)
		set_magic_quotes_runtime(0);
	
	@set_time_limit(0);
	
	$limite_memoire = @ini_get('memory_limit');
	
	if (!empty($limite_memoire))
	{
		$unite = strtolower(substr($limite_memoire, -1, 1));
		$limite_memoire = (int) $limite_memoire;

		if ($unite == 'k')
			$limite_memoire = floor($limite_memoire / 1024);
		else if ($unite == 'g')
			$limite_memoire *= 1024;
		else if (is_numeric($unite))
			$limite_memoire = floor((int) ($limite_memoire . $unite) / 1048576);
		$limite_memoire = max(128, $limite_memoire) . 'M';
	}
	else
		$limite_memoire = '128M';
	@ini_set('memory_limit', $limite_memoire);
	
	/*$_fo_products = _fo_products::getInstance();
	$_fo_products -> _id = 31;
	$_fo_products -> get();
	echo $_fo_products -> num_image;
	
	$obj = GP_sqlobjet::getInstance("SELECT id FROM _fo_products");
	$obj -> get();
	print_r($obj -> _res);*/
	
	$_fo_samples_by_country = _fo_samples_by_country::getInstance();
	$_fo_samples_by_country -> _id = 3;
	$_fo_samples_by_country -> get();
	$_fo_samples_by_country -> getCountryName();
	$_fo_samples_by_country -> getSampleName();
	echo $_fo_samples_by_country -> sample_name;
	echo $_fo_samples_by_country -> country_name;
	
?>